with Ada.Containers.Doubly_Linked_Lists;
with Legend.Interactives;
with Legend.Renders;
with Legend.Resources;
with SDL.Events;
package Legend.Items_Dialog is


   type Items_Filter_Type is access function (
      Item : Item_Type
      ) return Boolean;

   -- Name
   -- Description
   -- Table (5 Col * 3 Row)
   type Items_Dialog_Type is new Interactives.Interactive_Type with private;


   overriding
   procedure Paint (this : in out Items_Dialog_Type);

   overriding
   procedure On_Key_Up (
      this : in out Items_Dialog_Type;
      Message : SDL.Events.Keyboard_Event_t;
      Cancel_Bubble : in out Boolean
      );

   overriding
   procedure On_Timer (
      this          : in out Items_Dialog_Type;
      Timer         : Hash_Type;
      Count         : Natural;
      Cancel_Bubble : in out Boolean
      );

   procedure Setup (
      this : in out Items_Dialog_Type;
      Pictures : Pictures_Pointer := Resources.Outer_Images;
      Filter : Items_Filter_Type := null
      );

   function Selected (this : in out Items_Dialog_Type) return Item_Grid_Type;

private

   type Table_Cell_Type is record
      Item_Grid : Item_Grid_Type;
      Row, Col  : Natural;
   end record;


   package Item_Grid_Lists is 
      new Doubly_Linked_Lists(Table_Cell_Type);

   type Items_Dialog_Type is new Interactives.Interactive_Type with record
      Pictures : Pictures_Pointer := null;
      Filter   : Items_Filter_Type := null;
      Table    : Item_Grid_Lists.List;
      First    : Item_Grid_Lists.Cursor;
      Focus    : Item_Grid_Lists.Cursor;
   end record;

end Legend.Items_Dialog;
